package bjtu.tjj.simpledy.utils;

import cn.hutool.core.codec.Base64;

import java.nio.ByteBuffer;

public class Base64Utils {
    public static String encode(long value) {
        ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES);
        buffer.putLong(value);
        return Base64.encodeUrlSafe(buffer.array());
    }

    public static String encode(int value) {
        ByteBuffer buffer = ByteBuffer.allocate(Integer.BYTES);
        buffer.putInt(value);
        return Base64.encodeUrlSafe(buffer.array());
    }
}
